//
//  THSuggestViewController.m
//  TreeHole
//
//  Created by apple on 2020/9/9.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "THAddcommentViewController.h"
#import "STTools_TextView.h"
@interface THAddcommentViewController ()
@property(nonatomic, strong) STTools_TextView                     *text_view;/**<  */
@end

@implementation THAddcommentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"添加评论";
    self.tableView.backgroundColor = UIColor.whiteColor;
    [self config_tableHeader];
    [self stoneobs_fun_st_setRightItemWithTitle:@"发布" titleColor:STONEOBS_UI_FIRST_TEXT_COLOR];
    // Do any additional setup after loading the view.
}

#pragma mark --configSubView
- (void)config_tableHeader{
    UIView * header = [[UIView alloc] initWithFrame:STONEOBS_UI_UISCREEN_FRAME];
    
    CGFloat top = 10;
    ({
        UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(12, top, STONEOBS_UI_UISCREEN_WIDTH - 24, 156)];
        whiteView.backgroundColor = WH_UICOLOR_FROM_RGBA(0xEEEEEE);
        whiteView.layer.cornerRadius = 8;
        whiteView.clipsToBounds = YES;
        [header addSubview:whiteView];
        top = whiteView.bottom + 15;
        
        
        if (!self.text_view) {
            self.text_view = [[STTools_TextView alloc] initWithFrame:CGRectMake(10, 10, whiteView.width - 20, 160)];
            self.text_view.placeholder = @"..快写下你的评论";
            self.text_view.label.left = 15;
            self.text_view.label.top = 5;
            self.text_view.backgroundColor = UIColor.clearColor;
        }
        [whiteView addSubview:self.text_view];
        whiteView.height = 180;
        top = whiteView.bottom + 10;


    });

    header.height = top;
    self.tableView.tableHeaderView = header;
}

- (void)stoneobs_fun_st_rightBarAction:(id)sender{
    if (!self.text_view.text.length) {
        [SVProgressHUD showInfoWithStatus:@"请输入内容"];
        return;;
    }
    if (self.didFillComment) {
        self.didFillComment(self.text_view.text);
    }
    [self.navigationController popViewControllerAnimated:YES];
}
@end
